package com;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;

public class test {
    public static void main(String[] args) {
        String picName = "dddddddd.png";
        picName = picName.substring(picName.lastIndexOf("."));
        System.out.println(picName);
//        picName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd-HH-mm-ss-SS")) + picName;
        picName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSS")) + "pic" + picName;
        System.out.println(picName);

        //getName没有后缀
        String picName1 = "aaaa.png";
        //获取到后缀

        int poi = picName1.lastIndexOf(".");

        String suffix = picName1.substring(poi);
        System.out.println(suffix);
        String name = picName1.substring(0, poi);
        System.out.println(name);

        //给改为个新名字储存
        StringBuilder savaName = new StringBuilder();

        savaName.append(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSSS")));

        savaName.append(suffix);

        System.out.println(savaName);
    }

}
